package com.lightboat.system.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Schema(description = "城市树结果")
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY) // 属性为 空（""）[] 或者为 NULL 都不序列化
public class CrmCityTreeVo implements Serializable {

    private static final long serialVersionUID=1L;

    private Long id;

    @Schema(title = "城市id")
    private Long cityId;

    @Schema(title = "省市级别")
    private Integer level;

    @Schema(title = "父级id")
    private Long parentId;

    @Schema(title = "区号")
    private String areaCode;

    @Schema(title = "名称")
    private String name;

    @Schema(title = "合并名称")
    private String mergerName;

    @SchemaProperty(name = "经度")
    private String lng;

    @SchemaProperty(name = "纬度")
    private String lat;

    @SchemaProperty(name = "是否展示")
    private Boolean isShow;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = DateDeserializers.DateDeserializer.class)
    @JsonSerialize(using = DateSerializer.class)
    @SchemaProperty(name = "创建时间")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = DateDeserializers.DateDeserializer.class)
    @JsonSerialize(using = DateSerializer.class)
    @SchemaProperty(name = "修改时间")
    private Date updateTime;

    @SchemaProperty(name = "子结构")
    @JsonInclude(JsonInclude.Include.NON_EMPTY) // 属性为 空（""）[] 或者为 NULL 都不序列化
    private List<CrmCityTreeVo> child = new ArrayList<>();
}